import pygame
from pygame.locals import *
from pygame import *

class delete:
    def __init__(self, anything, application):
        # First check if the desired object is in spritelist
        for i in range(0, len(application.spritelist)):
            if anything == application.spritelist[i]:
            # Remove sprite from spritelist
                application.spritelist.remove(anything)
                # Render group
                application.spritegrouprender = pygame.sprite.OrderedUpdates(application.spritelist)
                # Draw rendered group
                application.spritegrouprender.draw(pygame.display.get_surface())
                # Show
                pygame.display.flip()
                break
